<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
    <link href="https://cdn.bootcss.com/Swiper/4.3.0/css/swiper.css" rel="stylesheet">
    <link rel="stylesheet" href="css/reset.css">
    <script src="https://cdn.bootcss.com/Swiper/4.3.0/js/swiper.js"></script>
    <style lang="">
        .nice {
            width: 100%;
            height: 100%;
            position: fixed;
            background: url(img/4.jpg) no-repeat center;
            background-size: cover;
            padding: 3rem 0;
        }
        
        .swiper-container {
            height: 7rem;
        }
        
        .swiper-wrapper .swiper-slide1 {
            background: url(img/1.jpg) no-repeat center center;
            background-size: contain;
        }
        
        .swiper-wrapper .swiper-slide2 {
            background: url(img/2.jpg) no-repeat center center;
            background-size: cover;
        }
        
        .swiper-wrapper .swiper-slide3 {
            background: url(img/3.jpg) no-repeat center center;
            background-size: cover;
        }
        
        .swiper-wrapper .swiper-slide4 {
            background: url(img/4.jpg) no-repeat center;
            background-size: cover;
        }
    </style>
</head>

<body>
    <div class="nice">
        <div class="swiper-container">
            <div class="swiper-wrapper">
                <div class="swiper-slide swiper-slide1"></div>
                <div class="swiper-slide swiper-slide2"></div>
                <div class="swiper-slide swiper-slide3"></div>
                <div class="swiper-slide swiper-slide4"></div>

            </div>

        </div>

    </div>

</body>

</html>
<script>
    var mySwiper = new Swiper('.swiper-container', {
        loop: true,
        direction: 'horizontal',
        speed: 5000,
        effect: 'coverflow',
        slidesPerView: 2,
        centeredSlides: true,
        autoplay: true,
        autoplay: {
            delay: 1000, //1秒切换一次
        },
        zoom: true,


        // 如果需要分页器
        pagination: {
            el: '.swiper-pagination',
        },

    })
</script>
</script>